package com.dashu.base.utils.encryption;


import lombok.extern.slf4j.Slf4j;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * AES256 加密
 */
@Slf4j
public class AES256 {

    /**
     * ase128加密
     * @param sSrc
     * @param sKey
     * @return
     */
    public static String Encrypt(String sSrc, String sKey) {
        if (sKey == null) {
            System.out.print("Key为空null");
            return null;
        }
        // 判断Key是否为16位
//        if (sKey.length() != 16) {
//            System.out.print("Key长度不是16位");
//            return null;
//        }
        byte[] raw = new byte[0];
        try {
            raw = sKey.getBytes("utf-8");
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
            cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
            byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
            //此处使用BASE64做转码功能，同时能起到2次加密的作用。
            return Base64.Encoder(encrypted);
        } catch (Exception e) {
            log.error("Encrypt:" , e);
        }
        return null;
    }

    /**
     * 加密
     * @param content
     * @param password
     * @return
     */
    public static String encrypt(String content, String password) {
        try {
//            //"AES"：请求的密钥算法的标准名称
//            KeyGenerator kgen = KeyGenerator.getInstance("AES");
//            //256：密钥生成参数；securerandom：密钥生成器的随机源
//            SecureRandom securerandom = new SecureRandom(tohash256Deal(password));
//            kgen.init(256, securerandom);
//            //生成秘密（对称）密钥
//            SecretKey secretKey = kgen.generateKey();
//            //返回基本编码格式的密钥
//            byte[] enCodeFormat = secretKey.getEncoded();
//            //根据给定的字节数组构造一个密钥。enCodeFormat：密钥内容；"AES"：与给定的密钥内容相关联的密钥算法的名称
//            SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
//            //将提供程序添加到下一个可用位置
////            Security.addProvider(new BouncyCastleProvider());
//            //创建一个实现指定转换的 Cipher对象，该转换由指定的提供程序提供。
//            //"AES/ECB/PKCS7Padding"：转换的名称；"BC"：提供程序的名称
//            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
//
//            cipher.init(Cipher.ENCRYPT_MODE, key);
//            byte[] byteContent = content.getBytes("utf-8");
//            byte[] cryptograph = cipher.doFinal(byteContent);

            System.out.println(password);
            byte[] raw = password.getBytes(Charset.forName("utf-8"));
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
            cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
            byte[] encrypted = cipher.doFinal(content.getBytes(Charset.forName("utf-8")));
            String base = Base64.Encoder(encrypted);
            if (base == null)
                return null;
            return AES256.parseByte2HexStr(base.getBytes(Charset.forName("utf-8")));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 解密
     * @param cryptograph
     * @param password
     * @return
     */
    public static String Decrypt(String cryptograph, String password) {
        try {
            System.out.println(password);
            byte[] bytes = Base64.Decoder(cryptograph.getBytes(Charset.forName("utf-8")));
            if (bytes == null)
                return null;

            byte[] raw = password.getBytes(Charset.forName("utf-8"));
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
            cipher.init(Cipher.DECRYPT_MODE, skeySpec);
            byte[] original = cipher.doFinal(bytes);

            return new String(original , Charset.forName("utf-8"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }





    /**
     * 解密
     * @param cryptograph
     * @param password
     * @return
     */
    public static String decrypt(String cryptograph, String password) {
        try {
//            KeyGenerator kgen = KeyGenerator.getInstance("AES");
//            SecureRandom securerandom = new SecureRandom(tohash256Deal(password));
//            kgen.init(256, securerandom);
//            SecretKey secretKey = kgen.generateKey();
//            byte[] enCodeFormat = secretKey.getEncoded();
//            SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
////            Security.addProvider(new BouncyCastleProvider());
//            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
//
            System.out.println(password);
            byte[] b = AES256.HexStr2ParseStr(cryptograph).getBytes(Charset.forName("utf-8"));
            byte[] bytes = Base64.Decoder(b);
            if (bytes == null)
                return null;
//
//            cipher.init(Cipher.DECRYPT_MODE, key);
//            byte[] content = cipher.doFinal(bytes);

            byte[] raw = password.getBytes(Charset.forName("utf-8"));
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
            cipher.init(Cipher.DECRYPT_MODE, skeySpec);
            byte[] original = cipher.doFinal(bytes);

            return new String(original , Charset.forName("utf-8"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    private static String parseByte2HexStr(byte buf[]) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < buf.length; i++) {
            String hex = Integer.toHexString(buf[i] & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }
            sb.append(hex.toUpperCase());
        }
        return sb.toString();
    }


    private static String HexStr2ParseStr(String str){
        byte[] bytes = new byte[str.length() / 2];
        for (int i = 0 ; i < str.length() / 2 ; i++){
            int b = Integer.parseInt(str.substring(i * 2 , i * 2 + 2) , 16);
            bytes[i] = (byte) b;
        }
        return new String(bytes , Charset.forName("utf-8"));
    }


    private static byte[] tohash256Deal(String datastr) {
        try {
            MessageDigest digester=MessageDigest.getInstance("SHA-256");
            digester.update(datastr.getBytes());
            return digester.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e.getMessage());
        }
    }


    public static void main(String[] args) {
//        String msg = FileUtils.readFile("G:\\bug\\zip\\20191225162822_511724420000-002_record_data.dat");
        String msg = "HZrQ/GBtic46i9mQjIvr8RreQLV/R/mQQs89rOmUc/jbFaIzdu/tM1IxXyLk19rWW/DnuFYFZVfE\n" +
                "sesD2uOmakTBrMUkoYmHg+Si8CABg+jURCrF5IU2DLL3g7JZMv82Lz7w6N+Q8kIbn+SWSrwyjyqg\n" +
                "sWAR5+XTAvZiUs+dyX3rW1NttvWZuUesPc1b+IlQBQ2KXCluXLgBasjP1LKljpJzvU/i49vNB1aP\n" +
                "B5D39zLPUSdwwzm4vcecLtOQCHNasZLP54UCmnWpgctgm4YctY7XRNTDX2L9QVUn0mAsHYMxVpqT\n" +
                "ew7P62tWG10sM6BgE3Zk8azymmpXCZdZJ9Bh5pnYJoACGl3CJcfPv8rJjsFkIg6OjuPjbT9vfRNd\n" +
                "J+0RweVIbm2RGe96Jxl3ftgllWaprjY9GJ68e0WIUAqgNsdC2aCrr7IwmTtKcLBpsVJT/XQkrrah\n" +
                "+NrEmj8msqKiFpwhHef2OQ4/wZDVJP+mJR4lcJ0VAyKaBgGGRxRR6S4gWK+Dk8tYxUCZol5/KsZP\n" +
                "/45XdTiIxl9iumOeRnIRln0w9rd+KgGvAAFTQM4h3JstOHzG5Wghe+MzLT54s/KrXSRVZw1DFSV/\n" +
                "v44S6AL6WW70V4KsFUtwFbSmVFWKL/CU6Ffnuldubpzht8IHCHQfXLUTszj0P/K8TqpiHCu3aiWQ\n" +
                "1+kR53pinVfO8qVTYsK1YU4xFzjx+vPPOjucS8DhUdTuHeOrhDTO8BRGPAGWLr5oYnTlu3UvW0Tz\n" +
                "fx3q3j+bvL34S8BQZSCKHIMHa+MvjEWOvE7cAPT3Y99Y9X1MIMKOCaFI9qHLp1WFWla7XCFgTC8V\n" +
                "Eu9xSOfhcFqOxV9JeXBRZeWoXJeD6E7kbmRoawKz0hMbaNEO2nSAt4e8xxjUzLjZAVPH/LWPT1+k\n" +
                "zzYe+O26OBd26w2lx7pRfqX3JdhH8VVmA8EG8X+nAnt6ZcZSpoZrj58Quzu6zFCmdqcyosNapTuU\n" +
                "HzybupMZmuRZ6iVwz3g3N3lJseWnSv4HyhUFE6PlHS3tEP2AHuxlMCh+2qQcnGw1p54SdbzoR6CA\n" +
                "tKvl5037BRngZRTQ7oRgNjLSAxFYwfMI2ND9pRUq+ip2e9y+zIHfOdcskDdDOr3yo3hkIg6OjuPj\n" +
                "bT9vfRNdJ+0RPi5kxCaQ1UWVcCw7olOnRGaprjY9GJ68e0WIUAqgNsdC2aCrr7IwmTtKcLBpsVJT\n" +
                "/XQkrrah+NrEmj8msqKiFqBoEbECjU2ZcyiauVJrvGVUXn3XAeVwK5P2iesNdWNjDdL82m6K9q7E\n" +
                "LVxfqakKvsHiv8712d3DNi3WkRI8D0Qw9rd+KgGvAAFTQM4h3JsteKvv70PZc0F1ms9b0pFcMHtT\n" +
                "cTJ6gSAfl/EDuk7/K3MISOn/0p5iPeOtY+/PihT9v5YY1TZ6N0fiNmzFf5u7tTsDuVC4OCiQUHCZ\n" +
                "iUmk7EZ6r96z4BPgo2Hh7845Nh37axCmNCD2d6REnWJHOheAVfLeRQJ82w15X0LxOaqayUpWp/MI\n" +
                "QtQxu33dIuhs3e4eSFS9Na2m9+xUKwyybwr8sS9XyINgfVtsPQ+I7rxeqiLQtHgwWPFWxALP9GHj\n" +
                "/oq8jZYkI9jbKrEv6EF48kPprUTBrMUkoYmHg+Si8CABg+jURCrF5IU2DLL3g7JZMv82Lz7w6N+Q\n" +
                "8kIbn+SWSrwyjyLtWKBm1+y/Mc3UhPagPxDK4XCimAuCavMlwlQUzXLsKyNwOrSJ2D+4JSUU7J5z\n" +
                "rbSSFgalg+8SezmpJnoPnIDPUSdwwzm4vcecLtOQCHNasZLP54UCmnWpgctgm4YctVKHNYS2jUZ6\n" +
                "s+7SjTH6Uzr1psWXC7Y5Y5tEasY9tOtHFmaFSU+PA8CwEK0t580xkwzUPcYxD5fneZ/9S1MYqfNk\n" +
                "Ig6OjuPjbT9vfRNdJ+0RutOqSot2IchVYdWwtXBBDWaprjY9GJ68e0WIUAqgNsdczKFB/+tuWxgh\n" +
                "bDg8hIws2JPvNu8Vk9m9ghNjCeHmO4ydT6VcLr1Gk8mbpjPEwg82YP3otf7us8zFjSl+vTkkBLRM\n" +
                "//T+FVsbv/hNfbhv8OSXZh0X4k8vMHIEMWI5N227mPC2Wf14jTZStEBlA6oPDj5faecsU2WYdCGt\n" +
                "6ixDoH1E+d+6jimAFDjCNibPInQaYMLQXTvS3NFoMFPzsXKkS0+/MXdB0nMRXoDlyQnNzqhluMpP\n" +
                "McMIiGNPrHucwd3ObT8TKFalkGBFZ/pt2tpQYU4xFzjx+vPPOjucS8DhUdTuHeOrhDTO8BRGPAGW\n" +
                "Lr5oYnTlu3UvW0Tzfx3q3j+bzbH6CW3tt+R7d5qqxVE/xUharBifydwFFRNfX/Z0BGaMBLi+7iWd\n" +
                "xYpTMoKpKR8zTJmJc0+J7DJX5zgO/dw22XBRZeWoXJeD6E7kbmRoawKz0hMbaNEO2nSAt4e8xxjU\n" +
                "vOQ/ukRQh7ybezbslOP/dAFmPMTn+Mf2Ih6QGFD0gR8vtXgEVkyK7xsCZrVt/RAghoShqSRYYIYi\n" +
                "ojbmKg2ejZVXPUWYDuPciLa3E8gjehnkWoC7DF7Sq3ORJqZmSPPCwXDI1dq+fV6W83xs0EEPnQKr\n" +
                "PWyq8m5QWUDVF9maqg8FwRTZIk1OfKvhvn5NH/SqUjyQvfAhC7oZOtcV3NBZJsP5vgdz+0k+bhst\n" +
                "8Y7Uu4XdykKzWuKmS9Q42pDGBFC57W22ESoUs7LZOC0iHvvDjYvfcCVns77mGN8CJ+uhrahY8Gjy\n" +
                "chGejDq6Kgm7b8HOsiPzgGNBhGj0EelMZozRNQMJntxpGoDbeVxO3v5kCJ/bQRQkXMU5S2LkjQir\n" +
                "A2IGs4AgWSDqb165X8lArm1GFhhK3pHYjLHY+n3TjlVfOpS7mPC2Wf14jTZStEBlA6oPammURHsP\n" +
                "lvvb13AJH1GZ3tewKn36ZSie87j5C0XrFi85MmkoRdpO0LkCv+6bzbCphoPfseO3f0pn7fH6GbqR\n" +
                "beb+P90EE8n11JZESZ+b/GXtPFoA6CnFB6/ziQEEVP274wRWpbKboV9N02uNA8eV6uD3FUNsR0HQ\n" +
                "6M+a/qpaeMMAi3UsjGOXJpcda3rKkP6c+1faMD4DSrRqV2XjvszjqtmFaRu4SoyS7F6BrjyIPEcZ\n" +
                "Ah365Th0lTneYywJ45k4MLqZzsTiLxLaUghObVxe2s9RJ3DDObi9x5wu05AIc1qxks/nhQKadamB\n" +
                "y2Cbhhy1jtdE1MNfYv1BVSfSYCwdg+uxxdEQfQPnQKuZRlr66TqQxFf2HEa14j53S6XcK8V13GjS\n" +
                "KtuXXt6Ihr/fZVTxpWQiDo6O4+NtP299E10n7RHo1YM5W4O2EjuS9eTpx7XTZqmuNj0Ynrx7RYhQ\n" +
                "CqA2x1zMoUH/625bGCFsODyEjCzYk+827xWT2b2CE2MJ4eY7hw6rQInrdatQmERx5JhLth0/DhUr\n" +
                "1gDXQry6JYRwPPVnlWKpUnQW7a+BGvFk3xwHRAQtFi4ShQ11oZwDP2ErW7uY8LZZ/XiNNlK0QGUD\n" +
                "qg9qaZREew+W+9vXcAkfUZne17AqffplKJ7zuPkLResWLxGppTzTdP05fwAj2Np97cA2WiiruFke\n" +
                "QpTyj1U+8ublrMIqMMQhpSuq3RE5KZ1UNeLVHY4g3mCxgC7ds/VyPZ3jBFalspuhX03Ta40Dx5Xq\n" +
                "4PcVQ2xHQdDoz5r+qlp4wwCLdSyMY5cmlx1resqQ/pxvrlDvQREPHXadD7znFB31kXue5fMXdRiS\n" +
                "dmjEIYBRMxr8nn1Il1e98vbHT2F7eQMte15HezaDIBNzf+s+OAsdz1EncMM5uL3HnC7TkAhzWrGS\n" +
                "z+eFApp1qYHLYJuGHLW2W/yzCemINTp+/KnKI/cyRMRpBtk8FTbWnCJEi6Ysz18zXCIEz9wts89H\n" +
                "auLOXxA5V3u2/iSFKFIJPRezr88bdRuslyWKS/10wg7vh7WXuw4i3QXlA8MprkSX7k4PNE5hGFZl\n" +
                "Gc6JfS2awlxzzG2+2D89f6KuBrib7sX8Ju9ZOQq3IPCmmOM7HTA+FDkr6aUySVnctSqAAXhBPp/3\n" +
                "GVm0Bzc4UxFFsRCCVepcg48ntMBdU4q0O+vx2lEUohes+o2uVzASxKM49ZMVBRDZCsO5I6+vpAsD\n" +
                "QkcXRKHh6nWmh+fuqAK3aAikx/+Rgg2MTaQlXuXNk9Rcyw0d+A+GykLHZG/7ZxKsGHzeTEYPC68r\n" +
                "9yOcA9a1tss3m3vrhzQLYmena1R1Le7yfuYMTBEGaI9Ofrq1IwOc1HfirjC7NL38A2sQpjQg9nek\n" +
                "RJ1iRzoXgFXUN2osqrS3I7QmdZkWxb+9/Yl0u359h/XJDoP45j22mlg/59GTSX6ppPuT4u0jE3BJ\n" +
                "mkp4IIhD68n9SnYzy3TclPgmaTN6Iti03w9Bx1Pfqh7IXZ/iTdY0SMdaov9tYi5wUWXlqFyXg+hO\n" +
                "5G5kaGsCs9ITG2jRDtp0gLeHvMcY1LzkP7pEUIe8m3s27JTj/3RPbAqD6b2LWKYdwthrpgTMteO0\n" +
                "4yCnYptitG8SfFo2REIn0vZWUIFtgcZuCpNI4h/c/FKdNlaH6hL2Piobz5dJ5FqAuwxe0qtzkSam\n" +
                "ZkjzwsFwyNXavn1elvN8bNBBD50RaNhN7MoQrPiQuMSIZL7GUWTYB46YP82631o9lDyZIzfDR4P4\n" +
                "CQJJqoY60HVWsJFDkHH4ZIZcv4nbDzUrhHzrRHqA6maovBrZF3V7peJ2TaI7TUuHzYBloAB9SfVH\n" +
                "p9Qjr6+kCwNCRxdEoeHqdaaH+xqaD/JuHANpLpVJy262USVe5c2T1FzLDR34D4bKQscQZzW/49hg\n" +
                "W5ERSosoLux7bsyJ9/r1H9B9rSmYENZFGss248G3RXGV7reKOoV5HHeBDaRIrelIe/vD6vDAM4cj\n" +
                "axCmNCD2d6REnWJHOheAVdQ3aiyqtLcjtCZ1mRbFv739iXS7fn2H9ckOg/jmPbaaYW3NVtFHX5vf\n" +
                "8QO1j/mwOngj//KB4zPlCWWkmuAqnDaP9FyukY42/qd01ZTh6W7fUf3O8IhT8DZNil1fclQBAXBR\n" +
                "ZeWoXJeD6E7kbmRoawKz0hMbaNEO2nSAt4e8xxjUzLjZAVPH/LWPT1+kzzYe+PtDsl5vkTNEkpWA\n" +
                "/IFfsIzlThoZ05XHcRQzn8AOoFBFMSQJ7I1idZRmpBqXlv4amtJfBT6UB7uU0DTaOBElngpwz3g3\n" +
                "N3lJseWnSv4HyhUFE6PlHS3tEP2AHuxlMCh+2qQcnGw1p54SdbzoR6CAtKvuWKjjhTh2vuBjA/Rz\n" +
                "dxKsyNfKEVzZChJYSO4TugeDmUMaykLi+qbavp/EfF6kILegfWn9W8E1O5GFcmPjZtkzoBARfiv6\n" +
                "fIyxXN1k+pqjb2aprjY9GJ68e0WIUAqgNsdC2aCrr7IwmTtKcLBpsVJT/XQkrrah+NrEmj8msqKi\n" +
                "Fv7ESXFYzcpF1fliNRnXaODX0617VfK0pAiwA5QNYpkhkZGWefUe2EyenDTxXiDePJmkjVOcvytq\n" +
                "AxcfG33QvpUw9rd+KgGvAAFTQM4h3JstOHzG5Wghe+MzLT54s/KrXSRVZw1DFSV/v44S6AL6WW4r\n" +
                "/V3Ff6Jcwlu9v2cUkxHKVF6wVijGQ5Qri7Alv3IKOO7KtW2PK4dzPn3dmzSJMEqPWoRNlecZcDFr\n" +
                "1cdQ3CvtYU4xFzjx+vPPOjucS8DhUdTuHeOrhDTO8BRGPAGWLr5oYnTlu3UvW0Tzfx3q3j+b2I1N\n" +
                "zZnNOYoWRPyQmh5T8z07s/GLRa0Fxd1fIKRHCycwtdxBfinr5/S5OmZIfjiFv+K4qIesALYhA0ZJ\n" +
                "ruqGy3BRZeWoXJeD6E7kbmRoawKz0hMbaNEO2nSAt4e8xxjUzLjZAVPH/LWPT1+kzzYe+PmbogGe\n" +
                "yhO+3hekW/zo4vEAYYh+3yb1SqgMWjBXczZmD+BpJ3stoVapYK+U6Qivf/IVM8GWwjh2U4P8NuBb\n" +
                "HUtwz3g3N3lJseWnSv4HyhUFE6PlHS3tEP2AHuxlMCh+2hLSjDcIWlop5G8CoAWGVaJvjQIfnZFF\n" +
                "zt1yHnzHwR246G/a6KEBf5cRV9cLMBqMiPkXNYYs20NPjAoPwbhKFlx8Q+cCbd2SA34RITzHOHeT\n" +
                "rrO7RUncNp18YYsRwhWub4vfcCVns77mGN8CJ+uhrahY8GjychGejDq6Kgm7b8HOsiPzgGNBhGj0\n" +
                "EelMZozRNURSfIXj9fZXp2q1A1bxEQg7hYRJkNIfMvI0gRmq3PSDEb/ZjMrLlftcpG3/Shh5zvvO\n" +
                "LmJQ0V9QUbhfrELFHj67mPC2Wf14jTZStEBlA6oPammURHsPlvvb13AJH1GZ3tewKn36ZSie87j5\n" +
                "C0XrFi+DTpH1DzLjojJVDMjFnTYC8xhz7gDpd8NkLHtuINcPhF9/Sqhcqgir/hojHACl/aMmsAZQ\n" +
                "ZVOEwBT2rSNxZmeC4wRWpbKboV9N02uNA8eV6uD3FUNsR0HQ6M+a/qpaeMPLRQh0kf4O+ZBNctsI\n" +
                "TKnDVvqKjz1u+vJLbHmWu4e4END6LVWVORSz3+m5VHyRY0+1vB0VHUpL7zzELIW1PkC7EI9N+nO4\n" +
                "A6YHShpLUGNcPc9RJ3DDObi9x5wu05AIc1qxks/nhQKadamBy2Cbhhy1tlv8swnpiDU6fvypyiP3\n" +
                "MlUaT3nUhd7Fe3KhJHVDs5VI92I/wpyBAdzyo/TIMWAiho+BUQoCIMku/P0zBgPMvjc9OZc11EYt\n" +
                "15jHtE5eh7+9wpFnGWrZFe0PA/RPBZ1MYRhWZRnOiX0tmsJcc8xtvhJx/HE7z+CBNqQBuHnbDt1v\n" +
                "INCnvBTHcPnFZTCEgOAbtgiLl7b4L36LILYw+RQ0A68yoEoo++QzKyZZ/qlVUPi7cM6+yDyqKaS2\n" +
                "W65L8XHP/L8VtwguIb6b5vDOLgG71DD2t34qAa8AAVNAziHcmy2Jtkhq9xVWtuoHVM8/ZhxisiPz\n" +
                "gGNBhGj0EelMZozRNfAgm9dq9pLEgV6OuPf1a4lF88TrcdOpnBnx1YSc44TnaR9NX1oicXzYghwa\n" +
                "kMJ/+AS0LxlpOvRUSw+RfszD89+7mPC2Wf14jTZStEBlA6oPUxhmr+lVpsjb188JkDncOi89QA9n\n" +
                "RjFsflly9Nyvwu/51TowgJ5YUbBDDSRVx1Lq7UbURi/XMgysg3GJ215DqbbmbfrCGbfmCA8qDxVG\n" +
                "SO3BoT7V98QYyEhQWkDyHXiqr7eeDLxjchsTBuxneqquttYYU+lvL16GI1C9ZhHC/IEkVWcNQxUl\n" +
                "f7+OEugC+lluG6bY9EJdX74DDclMUU+lb4z0+c12DDsxedaA53H6qlkzwnFynKmMI8UopE+AcETM\n" +
                "77w4+kTdNt1pTkCQ8472NmFOMRc48frzzzo7nEvA4VGwaFGv3tBcJddX9VmSpFIKBLSkfYcDb/T0\n" +
                "+BxNC+C/rLg1Ul4bi4/bnnT7ZJGgitUsQfG3MFn/kRoBoSC9vVkEUwjgf6NjyScgyZIxZYMFIkat\n" +
                "t1TaTDXY19oHKURvlq1EwazFJKGJh4PkovAgAYPo1EQqxeSFNgyy94OyWTL/NjqQDPwdgSKgoqjx\n" +
                "khZvoP9odPqKkkJ23/1OFYf12Wt2by3MbbINnL9GhX8SZxz14gcVp6FW353wzEog/cCyraUOjDLQ\n" +
                "UaISPqbHziaD68hvw7uzICY306+7/xCVFEA0R8JzMZqfsf8TJf5viJFxXs/JB4gveAkxcs+nH+Ob\n" +
                "HMqI61xZd/HUUlOBgI39hg+vEQ1FcgLWGzajAnGzY1phuhqdoX2woCC2H0OSZBUwH0iLhIOOmeGX\n" +
                "gHHO6ztIBq4FM89RJ3DDObi9x5wu05AIc1qxks/nhQKadamBy2Cbhhy14Qt6ZTi69xu6TXoaigui\n" +
                "Xpjb8dDd08mEZvDC4+AAoNE/9P9c3+52dLdpHm6R+RcHl3gNnxrA+SwQ88KCyNpNFQsp+UudS7DS\n" +
                "BwRv+IM0HTvAzDUHKCEbcyD4P7O8q0BhwXDI1dq+fV6W83xs0EEPndOcMGfmQT6pCEExOaDtO1Lz\n" +
                "InIYZu62ln8cVkY1xNFHDd06xNyfpXhAg4ycUH4BSn2zorzo+OVd0IW+l2QQURygfWn9W8E1O5GF\n" +
                "cmPjZtkzI9mAzN1OwWFiC00B/N9gTWaprjY9GJ68e0WIUAqgNsdjRUrwJeciA2sVPnAfXIEnBcEU\n" +
                "2SJNTnyr4b5+TR/0qja1Y5rbRQxzvjjoTrygx3s0wNkeVE8kYIsaEgHneZRpfEPnAm3dkgN+ESE8\n" +
                "xzh3k1TAl66865LzDJEia3X2Cw6L33AlZ7O+5hjfAifroa2oR0it07VQIt4asFp2wExSu28g0Ke8\n" +
                "FMdw+cVlMISA4Btzn/0L1AupRw7VtR4NI47gIdApK3ZBayH6bCHuPr4pLNjrphNWVfHwDdcSXZ0R\n" +
                "O3baUWN6OCuL26xNPW7g+ndMMPa3fioBrwABU0DOIdybLYm2SGr3FVa26gdUzz9mHGKyI/OAY0GE\n" +
                "aPQR6UxmjNE1HOl3z+UWWhGuvfsqhD2TUbWCe1gWYHuvt05bWMTBVWS8rJco9/YipFCzm78o020k\n" +
                "ByPVWyXWMcdaCsck5V2Xw7uY8LZZ/XiNNlK0QGUDqg9TGGav6VWmyNvXzwmQOdw6JV7lzZPUXMsN\n" +
                "HfgPhspCxyPthfEmuucnvMu4W1lWmp4kbxYuw1C//tdhIJE2wyf6HWuI+v3xt+Tq4iynImn9kp0d\n" +
                "YmSjMzFQQ/hD4AWcOL9rEKY0IPZ3pESdYkc6F4BVJOB6vPsqiv+nuQZL0i7gYtewKn36ZSie87j5\n" +
                "C0XrFi/KlLdlJAvhKtjisN3h0o9XWIKCS2Wb2UPbc2SIT2ljpyGrGl5hgwuys2KpeTRPwLv3qvfb\n" +
                "iAe+knj2ziUHh70D4wRWpbKboV9N02uNA8eV6gT3A1WQcoA9NiaVIbguLQVWp/MIQtQxu33dIuhs\n" +
                "3e4eeY7mE7WCeinYkEES/i5IqlKIsfJ6LnoCE+Nl1TL+Hbi8PJ3A1R1y/W00eysjOM84gbCXwuLD\n" +
                "MmRLubjV7NBwAkTBrMUkoYmHg+Si8CABg+jURCrF5IU2DLL3g7JZMv82OpAM/B2BIqCiqPGSFm+g\n" +
                "/46oFXMzGs4kbjz3Ple+wsbUrcLS0tdWZ9c421iwUGU4wKTQxiLRBiPzC6z+WQg3/gT7Cx02GFe4\n" +
                "Oy7XfbgwfKrDu7MgJjfTr7v/EJUUQDRHwnMxmp+x/xMl/m+IkXFez8kHiC94CTFyz6cf45scyoiL\n" +
                "IMdiA3lp647qkQA9K8/zJ3UXLAaQ0a5J4iujNyhsJFW23id5ibIff7w4XKW1DllEOpxO1ZvlpJHG\n" +
                "lSi3EBG+z1EncMM5uL3HnC7TkAhzWrGSz+eFApp1qYHLYJuGHLXhC3plOLr3G7pNehqKC6JeClBP\n" +
                "c9/eJXq+ajyasUcpbcXrE2M1EcVO814+FhghBXREPqV9nyjIRpt0O0qbu6vWOmpybQuLMSlRV7Gu\n" +
                "s2X+EsXktHiSsPcTBTBnzd2niLPBcMjV2r59XpbzfGzQQQ+d05wwZ+ZBPqkIQTE5oO07UthIAmiM\n" +
                "G5FM5j5Tww7gi9xcGfW8AsPgcrajJKk6rtYiUXnjC2cJiPP6TeDmQ5IwxXOCHbWFmQAE/cOiTXaw\n" +
                "Sn9OxHLd013EBMcj6LBzTGD7ZqmuNj0Ynrx7RYhQCqA2x2NFSvAl5yIDaxU+cB9cgSdRZNgHjpg/\n" +
                "zbrfWj2UPJkjUpzTznpU5DZOnloKyEpFhH3wCjpeWZ3DxFfOM9YIZCZCcgn6w6ONLaqyJZfap7h2\n" +
                "HeegirNW9LXxojZLp3gjnCOvr6QLA0JHF0Sh4ep1pocfnjy0quhyYTQB6DX9nKK32JPvNu8Vk9m9\n" +
                "ghNjCeHmO1jn3mSxwp6837+4I3bm09qLuwhbaZvM43JsGdbRYZFOws7p0SsfDhv8EcwYCzpZvmqC\n" +
                "O/yosoFLLdWO6hObrTO7mPC2Wf14jTZStEBlA6oPUxhmr+lVpsjb188JkDncOiVe5c2T1FzLDR34\n" +
                "D4bKQsdAo7GY00I3p5XWxE9msds8diI9FJPKSjkpUtPynN+Uqq7L9vgJ3aF8Jx5jN3Ngwv0N9m1h\n" +
                "9v+iUHQ9q4qHFCFqaxCmNCD2d6REnWJHOheAVSTgerz7Kor/p7kGS9Iu4GLXsCp9+mUonvO4+QtF\n" +
                "6xYvHRlpOPq6V9wS4VGNx+AjVVvaans+DccBFlwuRGTbbOPEIWPgGUdBwF8yiSZvITEr4u3KwYjJ\n" +
                "dKlr/uMsNRA/vuMEVqWym6FfTdNrjQPHleoE9wNVkHKAPTYmlSG4Li0F/Yl0u359h/XJDoP45j22\n" +
                "ms8n/wfcNScoHOzKIL2dSFL478ik+RQ3o6b1jWv+vS6eX7u20T5V2Yj0U5Sg84TdSRKGiem1/l2+\n" +
                "U2M5hKiLJFJwUWXlqFyXg+hO5G5kaGsCs9ITG2jRDtp0gLeHvMcY1LViIdgFq9Ku5JwnyAl2iQE7\n" +
                "2UJWzpB2o4lyufsDskxRZTsZCrzWdsIGC2gIQaiXRS0k2uas1udaYM52SPyGpnrzzqpHbNoCZ7Cp\n" +
                "eo0ilaNsz1EncMM5uL3HnC7TkAhzWrGSz+eFApp1qYHLYJuGHLXhC3plOLr3G7pNehqKC6JerEjm\n" +
                "GsTY96VJtmTBAML3pZx7ENL/VU+3wDsqDBv6UdcSH34fwMNyG0chzJisEeehscg+kPRlA2Uk6qdR\n" +
                "iObZgo8DzqZusyDf2/Rt8s2wHpnBcMjV2r59XpbzfGzQQQ+d05wwZ+ZBPqkIQTE5oO07UqqDr/y1\n" +
                "Linvei/uMiIH74A=";
        System.out.println(Decrypt(msg , "1234567890123456"));
    }
}
